diff options
Diffstat (limited to 'app/[lng]/engineering/(engineering)/vendors')
6 files changed, 395 insertions, 0 deletions
diff --git a/app/[lng]/engineering/(engineering)/vendors/[id]/info/items/page.tsx b/app/[lng]/engineering/(engineering)/vendors/[id]/info/items/page.tsx new file mode 100644 index 00000000..5d5838c6 --- /dev/null +++ b/app/[lng]/engineering/(engineering)/vendors/[id]/info/items/page.tsx @@ -0,0 +1,56 @@ +import { Separator } from "@/components/ui/separator" +import { getVendorItems } from "@/lib/vendors/service" +import { type SearchParams } from "@/types/table" +import { getValidFilters } from "@/lib/data-table" +import { searchParamsItemCache } from "@/lib/vendors/validations" +import { VendorItemsTable } from "@/lib/vendors/items-table/item-table" + +interface IndexPageProps { + // Next.js 13 App Router에서 기본으로 주어지는 객체들 + params: { + lng: string + id: string + } + searchParams: Promise<SearchParams> +} + +export default async function SettingsAccountPage(props: IndexPageProps) { + const resolvedParams = await props.params + const lng = resolvedParams.lng + const id = resolvedParams.id + + const idAsNumber = Number(id) + + // 2) SearchParams 파싱 (Zod) + // - "filters", "page", "perPage", "sort" 등 contact 전용 컬럼 + const searchParams = await props.searchParams + const search = searchParamsItemCache.parse(searchParams) + const validFilters = getValidFilters(search.filters) + + + + const promises = Promise.all([ + getVendorItems({ + ...search, + filters: validFilters, + }, + idAsNumber) + ]) + // 4) 렌더링 + return ( + <div className="space-y-6"> + <div> + <h3 className="text-lg font-medium"> + 공급품목(패키지) + </h3> + <p className="text-sm text-muted-foreground"> + {/* 딜리버리가 가능한 아이템 리스트를 확인할 수 있습니다. */} + </p> + </div> + <Separator /> + <div> + <VendorItemsTable promises={promises} vendorId={idAsNumber}/> + </div> + </div> + ) +}
\ No newline at end of file diff --git a/app/[lng]/engineering/(engineering)/vendors/[id]/info/layout.tsx b/app/[lng]/engineering/(engineering)/vendors/[id]/info/layout.tsx new file mode 100644 index 00000000..7e2cd4f6 --- /dev/null +++ b/app/[lng]/engineering/(engineering)/vendors/[id]/info/layout.tsx @@ -0,0 +1,94 @@ +import { Metadata } from "next" + +import { Separator } from "@/components/ui/separator" +import { SidebarNav } from "@/components/layout/sidebar-nav" +import { findVendorById } from "@/lib/vendors/service" // 가정: 여기에 findVendorById가 있다고 가정 +import { Vendor } from "@/db/schema/vendors" +import { Button } from "@/components/ui/button" +import { ArrowLeft } from "lucide-react" +import Link from "next/link" +export const metadata: Metadata = { + title: "Vendor Detail", +} + +export default async function SettingsLayout({ + children, + params, +}: { + children: React.ReactNode + params: { lng: string , id: string} +}) { + + // 1) URL 파라미터에서 id 추출, Number로 변환 + const resolvedParams = await params + const lng = resolvedParams.lng + const id = resolvedParams.id + + const idAsNumber = Number(id) + // 2) DB에서 해당 협력업체 정보 조회 + const vendor: Vendor | null = await findVendorById(idAsNumber) + + // 3) 사이드바 메뉴 + const sidebarNavItems = [ + { + title: "연락처", + href: `/${lng}/evcp/vendors/${id}/info`, + }, + { + title: "공급품목(패키지)", + href: `/${lng}/evcp/vendors/${id}/info/items`, + }, + { + title: "공급품목(자재그룹)", + href: `/${lng}/evcp/vendors/${id}/info/materials`, + }, + { + title: "견적 히스토리", + href: `/${lng}/evcp/vendors/${id}/info/rfq-history`, + }, + { + title: "입찰 히스토리", + href: `/${lng}/evcp/vendors/${id}/info/bid-history`, + }, + { + title: "계약 히스토리", + href: `/${lng}/evcp/vendors/${id}/info/contract-history`, + }, + ] + + return ( + <> + <div className="container py-6"> + <section className="overflow-hidden rounded-[0.5rem] border bg-background shadow"> + <div className="hidden space-y-6 p-10 pb-16 md:block"> + {/* RFQ 목록으로 돌아가는 링크 추가 */} + <div className="flex items-center justify-end mb-4"> + <Link href={`/${lng}/evcp/vendors`} passHref> + <Button variant="ghost" className="flex items-center text-primary hover:text-primary/80 transition-colors p-0 h-auto"> + <ArrowLeft className="mr-1 h-4 w-4" /> + <span>협력업체 목록으로 돌아가기</span> + </Button> + </Link> + </div> + <div className="space-y-0.5"> + {/* 4) 협력업체 정보가 있으면 코드 + 이름 + "상세 정보" 표기 */} + <h2 className="text-2xl font-bold tracking-tight"> + {vendor + ? `${vendor.vendorCode ?? ""} - ${vendor.vendorName} 상세 정보` + : "Loading Vendor..."} + </h2> + <p className="text-muted-foreground">협력업체 관련 상세사항을 확인하세요.</p> + </div> + <Separator className="my-6" /> + <div className="flex flex-col space-y-8 lg:flex-row lg:space-x-12 lg:space-y-0"> + <aside className="-mx-4 lg:w-1/5"> + <SidebarNav items={sidebarNavItems} /> + </aside> + <div className="flex-1">{children}</div> + </div> + </div> + </section> + </div> + </> + ) +}
\ No newline at end of file diff --git a/app/[lng]/engineering/(engineering)/vendors/[id]/info/materials/page.tsx b/app/[lng]/engineering/(engineering)/vendors/[id]/info/materials/page.tsx new file mode 100644 index 00000000..0ebb66ba --- /dev/null +++ b/app/[lng]/engineering/(engineering)/vendors/[id]/info/materials/page.tsx @@ -0,0 +1,56 @@ +import { Separator } from "@/components/ui/separator" +import { type SearchParams } from "@/types/table" +import { getValidFilters } from "@/lib/data-table" +import { searchParamsMaterialCache } from "@/lib/vendors/validations" +import { getVendorMaterials } from "@/lib/vendors/service" +import { VendorMaterialsTable } from "@/lib/vendors/materials-table/item-table" + +interface IndexPageProps { + // Next.js 13 App Router에서 기본으로 주어지는 객체들 + params: { + lng: string + id: string + } + searchParams: Promise<SearchParams> +} + +export default async function SettingsAccountPage(props: IndexPageProps) { + const resolvedParams = await props.params + const lng = resolvedParams.lng + const id = resolvedParams.id + + const idAsNumber = Number(id) + + // 2) SearchParams 파싱 (Zod) + // - "filters", "page", "perPage", "sort" 등 contact 전용 컬럼 + const searchParams = await props.searchParams + const search = searchParamsMaterialCache.parse(searchParams) + const validFilters = getValidFilters(search.filters) + + + + const promises = Promise.all([ + getVendorMaterials({ + ...search, + filters: validFilters, + }, + idAsNumber) + ]) + // 4) 렌더링 + return ( + <div className="space-y-6"> + <div> + <h3 className="text-lg font-medium"> + 공급품목(자재 그룹) + </h3> + <p className="text-sm text-muted-foreground"> + {/* 딜리버리가 가능한 공급품목(자재 그룹)을 확인할 수 있습니다. */} + </p> + </div> + <Separator /> + <div> + <VendorMaterialsTable promises={promises} vendorId={idAsNumber}/> + </div> + </div> + ) +}
\ No newline at end of file diff --git a/app/[lng]/engineering/(engineering)/vendors/[id]/info/page.tsx b/app/[lng]/engineering/(engineering)/vendors/[id]/info/page.tsx new file mode 100644 index 00000000..6279e924 --- /dev/null +++ b/app/[lng]/engineering/(engineering)/vendors/[id]/info/page.tsx @@ -0,0 +1,56 @@ +import { Separator } from "@/components/ui/separator" +import { getVendorContacts } from "@/lib/vendors/service" +import { type SearchParams } from "@/types/table" +import { getValidFilters } from "@/lib/data-table" +import { searchParamsContactCache } from "@/lib/vendors/validations" +import { VendorContactsTable } from "@/lib/vendors/contacts-table/contact-table" + +interface IndexPageProps { + // Next.js 13 App Router에서 기본으로 주어지는 객체들 + params: { + lng: string + id: string + } + searchParams: Promise<SearchParams> +} + +export default async function SettingsAccountPage(props: IndexPageProps) { + const resolvedParams = await props.params + const lng = resolvedParams.lng + const id = resolvedParams.id + + const idAsNumber = Number(id) + + // 2) SearchParams 파싱 (Zod) + // - "filters", "page", "perPage", "sort" 등 contact 전용 컬럼 + const searchParams = await props.searchParams + const search = searchParamsContactCache.parse(searchParams) + const validFilters = getValidFilters(search.filters) + + + + const promises = Promise.all([ + getVendorContacts({ + ...search, + filters: validFilters, + }, + idAsNumber) + ]) + // 4) 렌더링 + return ( + <div className="space-y-6"> + <div> + <h3 className="text-lg font-medium"> + Contacts + </h3> + <p className="text-sm text-muted-foreground"> + 업무별 담당자 정보를 확인하세요. + </p> + </div> + <Separator /> + <div> + <VendorContactsTable promises={promises} vendorId={idAsNumber}/> + </div> + </div> + ) +}
\ No newline at end of file diff --git a/app/[lng]/engineering/(engineering)/vendors/[id]/info/rfq-history/page.tsx b/app/[lng]/engineering/(engineering)/vendors/[id]/info/rfq-history/page.tsx new file mode 100644 index 00000000..c7f8f8b6 --- /dev/null +++ b/app/[lng]/engineering/(engineering)/vendors/[id]/info/rfq-history/page.tsx @@ -0,0 +1,55 @@ +import { Separator } from "@/components/ui/separator"
+import { getRfqHistory } from "@/lib/vendors/service"
+import { type SearchParams } from "@/types/table"
+import { getValidFilters } from "@/lib/data-table"
+import { searchParamsRfqHistoryCache } from "@/lib/vendors/validations"
+import { VendorRfqHistoryTable } from "@/lib/vendors/rfq-history-table/rfq-history-table"
+
+interface IndexPageProps {
+ // Next.js 13 App Router에서 기본으로 주어지는 객체들
+ params: {
+ lng: string
+ id: string
+ }
+ searchParams: Promise<SearchParams>
+}
+
+export default async function RfqHistoryPage(props: IndexPageProps) {
+ const resolvedParams = await props.params
+ const lng = resolvedParams.lng
+ const id = resolvedParams.id
+
+ const idAsNumber = Number(id)
+
+ // 2) SearchParams 파싱 (Zod)
+ // - "filters", "page", "perPage", "sort" 등 contact 전용 컬럼
+ const searchParams = await props.searchParams
+ const search = searchParamsRfqHistoryCache.parse(searchParams)
+ const validFilters = getValidFilters(search.filters)
+
+ const promises = Promise.all([
+ getRfqHistory({
+ ...search,
+ filters: validFilters,
+ },
+ idAsNumber)
+ ])
+
+ // 4) 렌더링
+ return (
+ <div className="space-y-6">
+ <div>
+ <h3 className="text-lg font-medium">
+ RFQ History
+ </h3>
+ <p className="text-sm text-muted-foreground">
+ 협력업체의 RFQ 참여 이력을 확인할 수 있습니다.
+ </p>
+ </div>
+ <Separator />
+ <div>
+ <VendorRfqHistoryTable promises={promises} />
+ </div>
+ </div>
+ )
+}
\ No newline at end of file diff --git a/app/[lng]/engineering/(engineering)/vendors/page.tsx b/app/[lng]/engineering/(engineering)/vendors/page.tsx new file mode 100644 index 00000000..52af0709 --- /dev/null +++ b/app/[lng]/engineering/(engineering)/vendors/page.tsx @@ -0,0 +1,78 @@ +import * as React from "react" +import { type SearchParams } from "@/types/table" + +import { getValidFilters } from "@/lib/data-table" +import { Skeleton } from "@/components/ui/skeleton" +import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton" +import { Shell } from "@/components/shell" + + +import { searchParamsCache } from "@/lib/vendors/validations" +import { getVendors, getVendorStatusCounts } from "@/lib/vendors/service" +import { VendorsTable } from "@/lib/vendors/table/vendors-table" +import { Ellipsis } from "lucide-react" + +interface IndexPageProps { + searchParams: Promise<SearchParams> +} + +export default async function IndexPage(props: IndexPageProps) { + const searchParams = await props.searchParams + const search = searchParamsCache.parse(searchParams) + + const validFilters = getValidFilters(search.filters) + + const promises = Promise.all([ + getVendors({ + ...search, + filters: validFilters, + }), + getVendorStatusCounts(), + ]) + + return ( + <Shell className="gap-2"> + + <div className="flex items-center justify-between space-y-2"> + <div className="flex items-center justify-between space-y-2"> + <div> + <h2 className="text-2xl font-bold tracking-tight"> + 협력업체 리스트 + </h2> + <p className="text-muted-foreground"> + 협력업체에 대한 요약 정보를 확인하고{" "} + <span className="inline-flex items-center whitespace-nowrap"> + <Ellipsis className="size-3" /> + <span className="ml-1">버튼</span> + </span> + 을 통해 담당자 연락처, 입찰 이력, 계약 이력, 패키지 내용 등을 확인 할 수 있습니다. <br/>벤더의 상태에 따라 가입을 승인해주거나 PQ 요청을 할 수 있고 검토가 완료된 벤더를 기간계 시스템에 전송하여 협력업체 코드를 따올 수 있습니다. + </p> + </div> + </div> + </div> + + + <React.Suspense fallback={<Skeleton className="h-7 w-52" />}> + {/* <DateRangePicker + triggerSize="sm" + triggerClassName="ml-auto w-56 sm:w-60" + align="end" + shallow={false} + /> */} + </React.Suspense> + <React.Suspense + fallback={ + <DataTableSkeleton + columnCount={6} + searchableColumnCount={1} + filterableColumnCount={2} + cellWidths={["10rem", "40rem", "12rem", "12rem", "8rem", "8rem"]} + shrinkZero + /> + } + > + <VendorsTable promises={promises} /> + </React.Suspense> + </Shell> + ) +} |
